package com.honghu.cloud.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.google.common.collect.Maps;
import com.honghu.cloud.bean.Transport;
import com.honghu.cloud.dao.TransportDao;
import com.honghu.cloud.common.service.BaseService;
import com.honghu.cloud.service.ITransportService;
import com.honghu.cloud.common.page.Page;

/**
 * 运费模板serviceImpl
 * @author Administrator
 *
 */
@Service
@Transactional(readOnly = true)
public class TransportServiceImpl extends BaseService<Transport> implements ITransportService {

	
	@Autowired
	private TransportDao transportDao;

	
	@Transactional(readOnly = false)
	public void batchDelObjs(List<Transport> objs) {
		if (objs != null && objs.size() > 0) {
			transportDao.batchDelete(objs);
		}
	}


	public Transport getObjByProperty(String key, String operation_symbol, Object value) {
		Map<String, Object> maps = Maps.newHashMap();
		maps.put("operation_property", key);
		maps.put("operation_symbol", operation_symbol);
		maps.put("operation_value", value);
		List<Transport> objs = transportDao.selectObjByProperty(maps);
		if (objs != null && objs.size() > 0) {
			return objs.get(0);
		}
		return null;
	}


	public List<Transport> selectObjByProperty(Map<String, Object> maps) {
		return transportDao.selectObjByProperty(maps);
	}


	public List<Transport> queryPages(Map<String, Object> params) {
		return transportDao.queryPages(params);
	}


	public List<Transport> queryPageListWithNoRelations(Map<String, Object> param) {
		return transportDao.queryPageListWithNoRelations(param);
	}


	public List<Transport> queryPagesWithNoRelations(Map<String, Object> params, Integer currentPage,
			Integer pageSize) {
		return transportDao.queryPagesWithNoRelations(params);
	}


	public Page<Transport> queryPagesWithNoRelations(Map<String, Object> params) {
		return super.queryPagesWithNoRelations(params);
	}


	public Page<Transport> list(Map<String, Object> params) {
		return super.list(params);
	}


	@Transactional(readOnly = false)
	public void batchDeleteByIds(List<Long> ids) {
		transportDao.batchDeleteByIds(ids);
	}


	@Transactional(readOnly = false)
	public void saveEntity(Transport obj) {
		transportDao.saveEntity(obj);
	}


	@Transactional(readOnly = false)
	public void updateById(Transport obj) {
		transportDao.updateById(obj);
	}


	@Transactional(readOnly = false)
	public void deleteById(Long id) {
		transportDao.deleteById(id);
	}


	public Transport selectByPrimaryKey(Long id) {
		return transportDao.selectByPrimaryKey(id);
	}


	public List<Transport> queryPageList(Map<String, Object> params, Integer begin, Integer max) {
		return super.queryPageList(params, begin, max);
	}


	public List<Transport> queryPageList(Map<String, Object> params) {
		return this.queryPageList(params, null, null);
	}


	public int selectCount(Map<String, Object> params) {
		Integer c = transportDao.selectCount(params);
		if (c == null) {
			return 0;
		}

		return c;

	}

}
